package com.fauks.ssm.spring.factory;

import com.fauks.ssm.spring.bean.Person;
import org.springframework.beans.factory.FactoryBean;

/**
 * bean的工厂类
 */
public class MyPersonFactoryBean implements FactoryBean<Person> {

    //创建bean
    @Override
    public Person getObject() throws Exception {
        System.out.println("p 创建啦.....");
        Person p = new Person();
        p.setName("MyPersonFactoryBean");
        return p;
    }

    //获取bean的class类型
    @Override
    public Class<?> getObjectType() {
        return Person.class;
    }

    //是否为单例
    @Override
    public boolean isSingleton() {
        return true;
    }
}
